package ControllerLayer.ControlServices.Segmenter;

import DataLayer.ImageDataContainer.ImageComponentsInfo.IImageComponentsInfo;
import DataLayer.ImageDataContainer.ImageInfo.IImageInfo;


public class MainSegmenter implements ISegmenter{
    protected CharacterSegmenter charSegm;
    protected WordSegmenter wordSegm;
    protected LineSegmenter lineSegm;

    /**
     * constructor
     */
    public MainSegmenter(){
        lineSegm = new LineSegmenter();
        wordSegm = new WordSegmenter();
        charSegm = new CharacterSegmenter();
    }

    /**
     * segments the given image to lines
     * @param imgCompInfo data structure containing the segmentation info
     * @param img image to segmentate
     */
    public void segmentLines(IImageComponentsInfo imageCompInfo, IImageInfo image){
        lineSegm.segmentLines(image);
        lineSegm.updateImageCompInfo(imageCompInfo);
    }


    /**
     * segments the given image to words
     * @param imgCompInfo data structure containing the segmentation info
     * @param img image to segmentate
     */
    public void segmentWords(IImageComponentsInfo imageCompInfo, IImageInfo image){
        wordSegm.segmentWords(imageCompInfo, image);
        wordSegm.updateImageCompInfo(imageCompInfo);
    }

    public void segmentCharacters(IImageComponentsInfo imgCompInfo, IImageInfo img) {
        charSegm.segmentChars(imgCompInfo, img);
        charSegm.updateImageCompInfo(imgCompInfo);
    }
}
